import BaseModel from '@/common/baseModelV3.js'

export default class CategoryModel extends BaseModel {
	constructor(source, func) {
		super(source, func)
	}
	objecrelation(source, func) {
		super.funcjudge(func)
		return func(source)
	}
	objectProcessor(source, func) {
		return new Category(source)
	}

	skeletonProcessor() {
		for (var i = 0; i < 6; i++) {
			this.data.push(new Category({
				title: '日用',
				image: 'https://krypton.qiniu.isartop.com/9404e202107071420551543.png',
				color: '#F8E1C2'
			}))
		}
	}
}

class Category extends BaseModel {
	constructor(source) {
		super()
		this.id = source?.id || 0
		this.image = super.checkURL(source?.image || '', getApp().globalData.img_pre)
		this.color = source?.color || '#F8E1C2'
		this.name = source?.title || ''
		this.path = source?.path || ''
		this.type = source?.type || ''
	}
}
